package com.nick.singleton;

/**
 * Created by xiaobao on 2017/7/18.
 * 利用类加载机制来初始化单例，但是有些时候有可能不是因为调用getInstance而加载该类，所以此处不是懒加载。
 */
public class Singleton4 {
    private static Singleton4 singleton = null;
    static {
        singleton = new Singleton4();
    }

    private Singleton4() {
    }
    public static synchronized Singleton4 getInstance() {
        return singleton;
    }
}
